# Copyright(c) 2008 Tri Tech Information Systems Inc. 
# Distributed under the Boost Software License, Version 1.0.
#     (See accompanying file ../../LICENSE_1_0.txt or copy at
#           http://www.boost.org/LICENSE_1_0.txt)
#     
"""
>>> import pyllvm
>>> pyllvm.Module("test")
<pyllvm.Module object at 0x...>

>>> from pyllvm import *
>>> mod = Module("test")
>>> args = [Type.IntTy, Type.IntTy, Type.IntTy]
>>> fn_type = FunctionType.get(Type.IntTy, args, False)
>>> mul_add = mod.getOrInsertFunction("mul_add", fn_type)
>>> bb = BasicBlock("entry", mul_add)
>>> bb
<pyllvm.BasicBlock object at 0x...>
>>> del mod

>>> mod = Module("test")
>>> Type.IntTy
<pyllvm.Type object at 0x...>
>>> args = [Type.IntTy, Type.IntTy, Type.IntTy]
>>> fn_type = FunctionType.get(Type.IntTy, args, False)
>>> fn_type
<pyllvm.FunctionType object at 0x...>
>>> mul_add = mod.getOrInsertFunction("mul_add", fn_type)
>>> mul_add
<pyllvm.Function object at 0x...>
>>> CallingConv.C
pyllvm.CallingConv.C
>>> mul_add.setCallingConv(CallingConv.C)
>>> mul_add.args()
[<pyllvm.Argument ...>, <pyllvm.Argument ...>, <pyllvm.Argument ...>]
>>> names = ["x", "y", "z"]
>>> for name, arg in zip(names, mul_add.args()):
...     arg.setName(name)
>>> x, y, z = mul_add.args()
>>> bb = BasicBlock("entry", mul_add)
>>> bb
<pyllvm.BasicBlock object at 0x...>

"""

if __name__ == '__main__':
    import doctest
    import sys
    sys.exit(doctest.testmod(optionflags=doctest.ELLIPSIS)[0])
